using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Dimok.Aspx.Manager;
using Dimok;
using Config = Dimok.Config;
using AOs = AcrobatObjects;

namespace Dimok.Aspx.Data.Forms {
	public partial class Contract: Page{
		protected void Page_Load(object sender, System.EventArgs e) {
			UOX uox = new UOX();
			Response.Cache.SetMaxAge(new TimeSpan(0,0,30));
			Response.ContentType = "Application/pdf";
			string filePath = UOX.GetQueryParam("FileName");
			filePath = HttpEx.MapPath("/Data/Forms/" + (filePath!=""?filePath:"Contract.pdf"));
			byte[] pdfFile = FileManager.GetBytesFromFile(filePath);
			pdfFile = AOs.AcrobatClient.FillPDFForm(pdfFile,uox.LoanInfo.Row);
			Response.BinaryWrite(pdfFile);
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e) {
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {    
		}
		#endregion
	}
}
